<?$gn = Group::group_names();?>
<style>
  .form_err {color:red; font-size: 90%; font-style:italic}
</style>
    
<div style="margin:10px">
    <h1>Users management</h1>
    <div>
        <a href="index.php?m=admin_users">Danh sách người dùng</a> | Tạo người dùng mới
    </div>
    
    <div style="background: #eee; padding:20px;width: 300px;text-align: left;margin:20px auto">
        <?if($error):?><div class="error">Something wrong!</div><?endif?>    
        <form action="index.php?m=admin_users&a=create&s=submit" method="POST" style="margin: 10px 30px;">
        Username:<br/>
        <?if(isset($error['user_name'])):?><div class="form_err"><?=$error['user_name']?></div><?endif?>
        <input type="text" name="user_name" value="<?=$data['user_name']?>"><br/>
        Password:<br/>
        <?if(isset($error['user_password'])):?><div class="form_err"><?=$error['user_password']?></div><?endif?>
        <input type="text" name="user_password" value="<?=$data['user_password']?>"><br/>
        User email:<br/>
        <?if(isset($error['user_email'])):?><div class="form_err"><?=$error['user_email']?></div><?endif?>
        <input type="text" name="user_email" value="<?=$data['user_email']?>"><br/>
        Real Name:<br/>
        <input type="text" name="user_realname" value="<?=$data['user_realname']?>"><br/>
        Group:
        <select name="group_id">
            <option value="0">-Select-</option>
            <?foreach($gn as $gid=>$n):?>
            <?$selected=($gid==$data['group_id'])?'selected':''?>
            <option value="<?=$gid?>"  <?=$selected?>><?=$n?></option>
            <?endforeach?>
        </select>   
        <p><input type="submit" value="Create User"><br/></p>
        </form>
    </div>   
</div>